﻿<navigation:Page
  x:Class="School.Home" 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
  mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"  
  Style="{StaticResource PageStyle}" xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices" xmlns:my="clr-namespace:School.Web" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">
    <navigation:Page.Resources>
        <CollectionViewSource x:Key="categoryCoursesViewSource" Source="{Binding Path=Data.Courses, ElementName=categoryDomainDataSource}" />
    </navigation:Page.Resources>
    <Grid x:Name="LayoutRoot">
        <riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance my:Category, CreateList=true}" Height="0" LoadedData="categoryDomainDataSource_LoadedData" Name="categoryDomainDataSource" QueryName="GetCategoriesQuery" Width="0">
            <riaControls:DomainDataSource.DomainContext>
                <my:DomainServiceCourses />
            </riaControls:DomainDataSource.DomainContext>
        </riaControls:DomainDataSource>
        <ListBox Height="320" HorizontalAlignment="Left" DisplayMemberPath="CategoryName" ItemsSource="{Binding ElementName=categoryDomainDataSource, Path=Data}" Margin="12,12,0,0" Name="categoryListBox" VerticalAlignment="Top" Width="120" />
        <sdk:DataGrid AutoGenerateColumns="False" Height="298" HorizontalAlignment="Left" ItemsSource="{Binding Source={StaticResource categoryCoursesViewSource}}" Margin="152,34,0,0" Name="coursesDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected" VerticalAlignment="Top" Width="414">
            <sdk:DataGrid.Columns>
                <sdk:DataGridTextColumn x:Name="categoryIdColumn" Binding="{Binding Path=CategoryId}" Header="Category Id" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="courseDescriptionColumn" Binding="{Binding Path=CourseDescription}" Header="Course Description" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="courseIdColumn" Binding="{Binding Path=CourseId, Mode=OneWay}" Header="Course Id" IsReadOnly="True" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="courseNameColumn" Binding="{Binding Path=CourseName}" Header="Course Name" Width="SizeToHeader" />
            </sdk:DataGrid.Columns>
        </sdk:DataGrid>
        <riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance my:Applicant, CreateList=true}" Height="0" LoadedData="applicantDomainDataSource_LoadedData" Name="applicantDomainDataSource" QueryName="GetApplicantsQuery" Width="0">
            <riaControls:DomainDataSource.DomainContext>
                <my:DomainServiceCourses />
            </riaControls:DomainDataSource.DomainContext>
        </riaControls:DomainDataSource>
        <Grid DataContext="{Binding ElementName=applicantDomainDataSource, Path=Data}" HorizontalAlignment="Left" Margin="12,355,0,0" Name="grid1" VerticalAlignment="Top">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <sdk:Label Content="Name:" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1"  Grid.Row="0" Height="23" HorizontalAlignment="Left" Margin="3" Name="nameTextBox" Text="{Binding Path=Aplic.Name, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" />
        </Grid>
    </Grid>

</navigation:Page>